home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: yurif@ix.netcom.com (Yuri Finkelstein)
- Newsgroups: comp.lang.c++
- Subject: Can you explain this?
- Date: Wed, 06 Mar 1996 08:26:26 GMT
- Organization: Netcom
- Message-ID: <4hjijm$370@dfw-ixnews1.ix.netcom.com>
- NNTP-Posting-Host: srf-ca3-03.ix.netcom.com
- X-NETCOM-Date: Wed Mar 06 2:32:54 AM CST 1996
- X-Newsreader: Forte Free Agent 1.0.82
-
- Can anybody explain why this tiny piece of code doesn't work in CASE1
- ( linker error )? Or it's just MSVC 4.0 specific?
- Any help will be appreciated.
- //--------------------------------------------------------------------------------------
- #define CASE1
- //#define CASE2
- //#define CASE3
-
- template <class T> void SetParam( T* pT, int a )
- {
- pT->m_a = a;
- }
-
- class FOO
- {
-
- #ifdef CASE3
- public:
- #endif
- int m_a;
-
- #ifdef CASE1
- friend void SetParam( FOO* pFOO, int a );
- #endif
-
- public:
- void Bar( int a ) { SetParam( this, a ); }
- }
-
- int main()
- {
- FOO foo;
- foo.Bar( 5 );
- return 0;
- }
- ------------------------------------------------
- Yuri Finkelstein
- (415) 389-0653 (home)
-
-